<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src='../js/旧版本/react.development.js'></script>
    <script src='../js/旧版本/react-dom.development.js'></script>
    <script src='../js/旧版本/babel.min.js'></script>
    <script src='../js/旧版本/prop-types.js'></script>
</head>

<body>
    <div id="test"></div>
    <script type='text/babel'>
        class Login extends React.Component {
            state = { username: "", password: "" }
            handleSubmit = (e) => {
                e.preventDefault()
                const { username, password } = this.state
                alert(`你的用户名：${username}，你的密码是：${password}`)
            }
            changeUserName = (e) => {
                this.setState({ username: e.target.value })
            }
            changePassword = (e) => {
                this.setState({ password: e.target.value })
            }
            render() {
                return (
                    <div>
                        <form action="http://www.baidu.com" onSubmit={this.handleSubmit}>
                            用户名：<input onChange={this.changeUserName} type="text" name='username' />
                            密码： <input onChange={this.changePassword} type="text" name='password' />
                            <button>登录</button>
                        </form>
                    </div>
                )
            }
        }

        ReactDOM.render(<Login />, document.querySelector("#test"))
    </script>
</body>

</html>